/*
 * @Descripttion: 
 * @version: 
 * @Author: mmzhang
 * @Date: 2021-07-27 16:02:34
 * @LastEditTime: 2022-06-14 13:27:05
 */
import table from '@/components/dt/table/render.js'
import nameOpt from '@/biz/option/name.js'
import dateOpt from '@/biz/option/date.js'
import Opt from '@/components/dt/info/Opt.js'
import CustomerMgr from '@/biz/customer/customerOpt.js';

let _this = null

class Column extends Opt {
  constructor(vm) {
    super()
    _this = vm
    this.build()
  }

  build() {
    this.createAll()
    this.opts.push(...this.all)
  }

  createAll() {
    this.all = [

      {
        title: "下载内容",
        field: "downloadName",
        minWidth: 100,
      },
      {
        title: "案场名称",
        field: "buildingName",
        minWidth: 100,
      },
      {
        title: "所属城市",
        field: "cityName",
        minWidth: 100,
      },
      {
        title: "模块",
        field: "module",
        minWidth: 180,
      },
      {
        title: "操作人",
        field: "createName",
        minWidth: 160,
      },
      {
        title: "操作时间",
        field: "createTime",
        minWidth: 160,
      },
      {
        title: '操作',
        fixed: 'right',
        width: 100,
        align: 'center',
        slots: {
          default: (params, h) => {
            let btns = []
            btns.push({
              title: params.row.status == 2 ? "下载" : params.row.statusName,
              event: params.row.status == 2 ? 'enclosureDownload' : '',
              data: params.row,
              color: params.row.status == 2 ? "#2d8cf0" : "#e8eaec",
              cursor: params.row.status == 2 ? "pointer" : "auto",
            })

            return table.cell.btns(_this, h, btns)
          }
        }
      },
      // {
      //   title: "操作",
      //   field: "result",
      //   minWidth: 80,
      //   render: (h, params) => {
      //     return h(
      //       "a",
      //       {
      //         style: {
      //           color: params.row.status == 2 ? "#2d8cf0" : "#e8eaec",
      //           cursor: params.row.status == 2 ? "pointer" : "auto",
      //         },
      //         on: {
      //           click: (e) => {
      //             e.stopPropagation();
      //             params.row.status == 2 &&
      //               this.enclosureDownload(params.row);
      //           },
      //         },
      //       },
      //       params.row.status == 2 ? "下载" : params.row.statusName
      //     );
      //   },
      // },

    ]
  }

}

export default Column